<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>10_过渡&动画2</title>
    <style>
      /* 显示到隐藏 */
      /* 运动中间：设置元素运动方式 */
      .v-leave-active {
        animation: move 4s linear 2s alternate;
      }

      /* 隐藏到显示 */
      /* 运动中间：设置元素运动方式 */
      .v-enter-active {
        animation: move 4s linear 2s alternate-reverse;
      }

      @keyframes move {
        0% {
          transform: translateX(0);
        }
        50% {
          transform: translateX(200px);
        }
        100% {
          transform: translateX(100px);
        }
      }
    </style>
  </head>
  <body>
    <div id="root">
      <button @click="isShow = !isShow">按钮</button>
      <transition>
        <p v-show="isShow">静哥头发自带logo</p>
      </transition>
    </div>
    <script type="text/javascript" src="../js/vue.js"></script>
    <script>
      new Vue({
        el: "#root",
        data: {
          isShow: true,
        },
      });
    </script>
  </body>
</html>
